package kr.saeildamil.androidstudy_second21;

import kr.saeildamil.androidstudy_second.R;
import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.widget.Button;

public class OverlayActionBar extends Activity {
	//style에 테마를 추가 하여 메니페스트에서 액티비티의 테마를 바꿔준다.
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch21_showhideactionbar);
	}
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// TODO Auto-generated method stub
		super.onCreateOptionsMenu(menu);
		MenuInflater infalter=getMenuInflater();
		infalter.inflate(R.menu.main, menu);
		return true;
	}
	
	public void mOnClick(View v){
		switch (v.getId()) {
		case R.id.ch21_showhideactionbar_toggle:
			ActionBar ab=getActionBar();
			if(ab.isShowing()){
				ab.hide();
				((Button) v).setText("Show Action Bar");
			}else{
				ab.show();
				((Button) v).setText("Hide Action Bar");
			}
			break;
		}
	}
}
